/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.isd.facturacion.modelo;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import com.isd.global.modelo.CodigoPostal;
import com.isd.global.modelo.Pais;
import com.isd.global.modelo.Transporte;

/**
 *
 * @author ctrosch
 */
/**
@Embeddable
public class DatosDeEntrega implements Serializable {

    //Código de entrega
    @Column(name = "FCRMVH_CDENT1", length = 6)
    private String cdent1;

    //Transportista
    @JoinColumn(name = "FCRMVH_TRACOD", referencedColumnName = "GRTTRA_TRACOD", nullable = false)
    @ManyToOne
    private Transporte transporte;

    //Direccion de entrega
    @Column(name = "FCRMVH_DIRENT", length = 60)
    private String dirent;

    //Pais de entrega
    @JoinColumn(name = "FCRMVH_PAIENT", referencedColumnName = "GRTPAH_CODPAI", nullable = false)
    @ManyToOne
    private Pais pais;

    //Codigo postal entrega
    @JoinColumns({
        @JoinColumn(name = "FCRMVH_CODENT", referencedColumnName = "GRTPAC_CODPOS", nullable = false),
        @JoinColumn(name = "FCRMVH_PAIENT", referencedColumnName = "GRTPAC_CODPAI", nullable = false, insertable=false, updatable=false)
    })
    @ManyToOne
    private CodigoPostal codigoPostalEntrega;

    //Descripción de transportista
    @Column(name = "FCRMVH_TRANSP", length = 60)
    private String transp;

    //Tipo documento transporte
    @Column(name = "FCRMVH_TIPDOC", length = 4)
    private String tipdoc;

    //Numero de documento transporte
    @Column(name = "FCRMVH_TRCUIT", length = 50)
    private String trcuit;

    //Direccion transporte
    @Column(name = "FCRMVH_TRANDR", length = 60)
    private String trandr;

    //Codigo de zona
    @Column(name = "FCRMVH_CODZON", length = 6)
    private String codzon;


    //Nro de cuenta de entrega
    @Column(name = "FCRMVH_CTAEN1", length = 13)
    private String ctaen1;    

    public DatosDeEntrega() {
        
        cdent1 = "01";
        codzon = "01";        
    }
    
    public Transporte getTransporte() {
        return transporte;
    }

    public void setTransporte(Transporte transporte) {
        this.transporte = transporte;

        if(transporte!=null){
            transp = transporte.getDescrp();
            trcuit = transporte.getNrodoc();
            tipdoc = transporte.getTipoDocumento().getTipdoc();
            trandr = transporte.getTradir();
        }
    }

    public String getDirent() {
        return dirent;
    }

    public void setDirent(String dirent) {
        this.dirent = dirent;
//        if(dirent!=null){
//            cdent1 = dirent;
//        }
    }

    public String getTrcuit() {
        return trcuit;
    }

    public void setTrcuit(String trcuit) {
        this.trcuit = trcuit;
    }

    public String getTipdoc() {
        return tipdoc;
    }

    public void setTipdoc(String tipdoc) {
        this.tipdoc = tipdoc;
    }

    public String getTrandr() {
        return trandr;
    }

    public void setTrandr(String trandr) {
        this.trandr = trandr;
    }

    public String getTransp() {
        return transp;
    }

    public void setTransp(String transp) {
        this.transp = transp;
    }

    public CodigoPostal getCodigoPostalEntrega() {
        return codigoPostalEntrega;
    }

    public void setCodigoPostalEntrega(CodigoPostal codigoPostalEntrega) {
        this.codigoPostalEntrega = codigoPostalEntrega;
    }

    public Pais getPais() {
        return pais;
    }

    public void setPais(Pais pais) {
        this.pais = pais;
    }

    public String getCodzon() {
        return codzon;
    }

    public void setCodzon(String codzon) {
        this.codzon = codzon;
    }

    public String getCdent1() {
        return cdent1;
    }

    public void setCdent1(String cdent1) {
        this.cdent1 = cdent1;
    }

    public String getCtaen1() {
        return ctaen1;
    }

    public void setCtaen1(String ctaen1) {
        this.ctaen1 = ctaen1;
    }   
    
}
 * */
